package com.yaxi.multipkid

import android.support.v7.app.AppCompatActivity
import android.os.Bundle
import android.widget.TextView
import android.content.pm.PackageManager
import android.text.InputFilter
import android.util.Log
import android.widget.EditText
import com.yaxi.multipkid.filter.DecimalLengthFilter
import com.yaxi.multipkid.filter.IntegerLengthFilter


class MainActivity : AppCompatActivity() {
    private val TAG: String = "MainActivity"

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)

        findViewById<TextView>(R.id.show).text = String.format("ApplicationId : %s \n %s",BuildConfig.APPLICATION_ID,BuildConfig.build_field_1)

        findViewById<EditText>(R.id.edit_text).filters = arrayOf(DecimalLengthFilter(3),IntegerLengthFilter(5))

        Log.i(TAG, "onCreate: " + getActivityMetaData());
    }


    private fun getActivityMetaData(): String {
        val info = packageManager.getActivityInfo(componentName, PackageManager.GET_META_DATA)
        return info.metaData.getString("extra")
    }
}
